using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;

namespace Xms.Abp.BackgroundJob;

public interface IBackgroundJobManager
{
    Task<Guid> EnqueueAsync<TArgs>(
        TArgs args,
        Guid? tenantId,
        BackgroundJobPriority priority = BackgroundJobPriority.Normal,
        TimeSpan? delay = null,
        int? timeout = null,
        short? maxTryCount = null,
        IEnumerable<int> retryIntervals = null,
        IEnumerable<Guid> referenceJobs = null,
        Guid? scheduleId = null,
        CancellationToken stoppingToken = default
    );

    Task<Guid> EnqueueAsync(
        string jobName,
        string displayName,
        object args,
        Guid? tenantId,
        BackgroundJobPriority priority = BackgroundJobPriority.Normal,
        TimeSpan? delay = null,
        int? timeout = null,
        short? maxTryCount = null,
        IEnumerable<int> retryIntervals = null,
        IEnumerable<Guid> referenceJobs = null,
        Guid? scheduleId = null,
        CancellationToken stoppingToken = default);

    bool IsAvailable();
}
